---
title: "Reference: Agent.getInstructions() | Agents"
description: "Documentation for the `Agent.getInstructions()` method in Mastra agents, which retrieves the instructions that guide the agent's behavior."
---

# Agent.getInstructions()

The `.getInstructions()` method retrieves the instructions configured for an agent, resolving them if they're a function. These instructions guide the agent's behavior and define its capabilities and constraints.

## Usage example

```typescript copy
await agent.getInstructions();
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "options",
      type: "{ requestContext?: RequestContext }",
      isOptional: true,
      defaultValue: "{}",
      description: "Optional configuration object containing request context.",
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "instructions",
      type: "SystemMessage | Promise<SystemMessage>",
      description:
        "The instructions configured for the agent. SystemMessage can be: string | string[] | CoreSystemMessage | CoreSystemMessage[] | SystemModelMessage | SystemModelMessage[]. Returns either directly or as a promise that resolves to the instructions.",
    },
  ]}
/>

## Extended usage example

```typescript copy
await agent.getInstructions({
  requestContext: new RequestContext(),
});
```

### Options parameters

<PropertiesTable
  content={[
    {
      name: "requestContext",
      type: "RequestContext",
      isOptional: true,
      defaultValue: "undefined",
      description:
        "Request Context for dependency injection and contextual information.",
    },
  ]}
/>

## Related

- [Agents overview](/docs/v1/agents/overview)
- [Request Context](/docs/v1/server-db/request-context)
